<!DOCTYPE html>
<html lang="en">

<!-- Head tag -->
<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!--Description-->
    
        <meta name="description" content="git 版本控制工具新项目：配置用户信息git config –global user.name 李git config –global user.email 李@qq.com初始化本地仓库git init把项目文件纳入git 管理（添加到暂存区）git add 提交代码 (把暂存区代码提交到本地仓">
    

    <!--Author-->
    
        <meta name="author" content="John Doe">
    

    <!--Open Graph Title-->
    
        <meta property="og:title" content="git二"/>
    

    <!--Open Graph Description-->
    

    <!--Open Graph Site Name-->
    <meta property="og:site_name" content="Hexo"/>

    <!--Type page-->
    
        <meta property="og:type" content="article" />
    

    <!--Page Cover-->
    

        <meta name="twitter:card" content="summary" />
    

    <!-- Title -->
    
    <title>git二 - Hexo</title>

    <!-- Bootstrap Core CSS -->
    <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>

    <!-- Custom CSS -->
    <link rel="stylesheet" href="/css/style.css">

    <!-- Custom Fonts -->
    <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" type="text/css">
    <link href="//fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic" rel="stylesheet" type="text/css">
    <link href="//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800" rel="stylesheet" type="text/css">

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="//oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="//oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

    <!-- Gallery -->
    <link href="//cdnjs.cloudflare.com/ajax/libs/featherlight/1.3.5/featherlight.min.css" type="text/css" rel="stylesheet" />

    <!-- Google Analytics -->
    


    <!-- favicon -->
    
	
</head>


<body>

    <!-- Menu -->
    <!-- Navigation -->
<nav class="navbar navbar-default navbar-custom navbar-fixed-top">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header page-scroll">
            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/">逐风</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav navbar-right">
                
                    <li>
                        <a href="/">
                            
                                Home
                            
                        </a>
                    </li>
                
                    <li>
                        <a href="/archives">
                            
                                Archives
                            
                        </a>
                    </li>
                
                    <li>
                        <a href="/tags">
                            
                                Tags
                            
                        </a>
                    </li>
                
                    <li>
                        <a href="/categories">
                            
                                Categories
                            
                        </a>
                    </li>
                
                    <li>
                        <a href="https://github.com/klugjo/hexo-theme-clean-blog">
                            
                                <i class="fa fa-github fa-stack-2x"></i>
                            
                        </a>
                    </li>
                
            </ul>
        </div>
        <!-- /.navbar-collapse -->
    </div>
    <!-- /.container -->
</nav>

    <!-- Main Content -->
    <!-- Page Header -->
<!-- Set your background image for this header in your post front-matter: cover -->

<header class="intro-header" style="background-image: url('http://www.codeblocq.com/assets/projects/hexo-theme-clean-blog/img/home-bg.jpg')">
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <div class="post-heading">
                    <h1>git二</h1>
                    
                    <span class="meta">
                        <!-- Date and Author -->
                        
                        
                            2016-12-20
                        
                    </span>
                </div>
            </div>
        </div>
    </div>
</header>

<!-- Post Content -->
<article>
    <div class="container">
        <div class="row">

            <!-- Tags and categories -->
           

            <!-- Gallery -->
            

            <!-- Post Main Content -->
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <p>git 版本控制工具<br>新项目：<br>配置用户信息<br>git config –global user.name 李<br>git config –global user.email 李@qq.com<br>初始化本地仓库<br>git init<br>把项目文件纳入git 管理（添加到暂存区）<br>git add <em><br>提交代码 (把暂存区代码提交到本地仓库)<br>git commit -m ‘写完了’<br>查看文件状态<br>git status<br>git log 查看仓库<br>add 之后未commit的撤回(回滚) git rm –cached 文件列表<br>commit之后的撤回<br>git reset - -hard 标识符数字（撤回到*</em>标识符数字）(代码思路错误，撤回这次所提交的所有代码) 回滚本地操作的快照，使用本地仓库的快照覆盖暂存区，使用本地仓库的快照覆盖工作目录<br>git reset - -soft 标识符数字 只回滚本地操作的快照 (不改变代码，适用于有很少的小bug时)<br>git reset 空/(- -mixed（默认） 最新的标识符数字) 使用本地仓库的快照覆盖暂存区,但是不覆盖工作目录  相当于git add 的逆操作，不改变工作目录的代码</p>
<p>HEAD表示本地仓库的最新快照<br>  一个^表示上一次快照<br>  回滚最后一次提交(取消最后一次提交)<br>  git reset - -hard HEAD^<br>  git reset - -hard 倒数第二个commitID<br>git add 的逆操作：<br>  git reset - -mixed HEAD<br>  git reset HEAD<br>  git reset 最后一次commitID</p>
<p>  git rm - -cached 文件列表</p>
<p>  回滚所有的修改操作（用暂存区覆盖工作目录）小心使用<br>  git checkout 文件列表<br>  git checkout .<br>关于分支<br>查看 git branch<br>创建 git  branch  分支名<br>切换 git checkout  分支名<br>创建并切换 git checkout -b 分支名称<br>合并 git merge 来源分支的分支名称 (来源分支)<br>删除分支 git branch -d 分支名称 （分支必须被合并过之后才能删除，否则删不掉，在来源分支下删它的分支）<br> git branch -D 分支名称（强制删除分支）</p>
<p> 远程操作：<br> 第一次获取代码一般使用如下命令：<br>  git clone 远程仓库的地址 项目名称（可选的）<br> 上传代码<br>  git push 远程仓库的地址 本地分支名称:远程分支的名称<br>  git push 远程仓库的地址 本地分支名称</p>
<p>  下载代码<br>  git pull 远程仓库的地址：远程分支的名称 本地分支的名称<br>  git pull 远程仓库的地址 远程分支的名称</p>
<p>  git remove  add 别名  仓库 地址<br>  git remove -v 查看仓库别名<br>  git push -u </p>


                
            </div>

            <!-- Comments -->
            
                <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                    


                </div>
            
        </div>
    </div>
</article>

    <!-- Footer -->
    <hr />

<!-- Footer -->
<footer>
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
                <ul class="list-inline text-center">
                    

                    

                    
                        <li>
                            <a href="https://github.com/klugjo/hexo-theme-clean-blog" target="_blank">
                                <span class="fa-stack fa-lg">
                                    <i class="fa fa-circle fa-stack-2x"></i>
                                    <i class="fa fa-github fa-stack-1x fa-inverse"></i>
                                </span>
                            </a>
                        </li>
                    

                    

                    

                    
                </ul>
                <p class="copyright text-muted">&copy; 2018 John Doe<br></p>
                <p class="copyright text-muted">Original Theme <a target="_blank" href="http://startbootstrap.com/template-overviews/clean-blog/">Clean Blog</a> from <a href="http://startbootstrap.com/" target="_blank">Start Bootstrap</a></p>
                <p class="copyright text-muted">Adapted for <a target="_blank" href="https://hexo.io/">Hexo</a> by <a href="http://www.codeblocq.com/" target="_blank">Jonathan Klughertz</a></p>
            </div>
        </div>
    </div>
</footer>


    <!-- After footer scripts -->
    
<!-- jQuery -->
<script src="//code.jquery.com/jquery-2.1.4.min.js"></script>

<!-- Bootstrap -->
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

<!-- Gallery -->
<script src="//cdnjs.cloudflare.com/ajax/libs/featherlight/1.3.5/featherlight.min.js" type="text/javascript" charset="utf-8"></script>

<!-- Disqus Comments -->



</body>

</html>